package util;

import com.google.gson.GsonBuilder;
import com.alibaba.fastjson.JSONObject;

public class JsonUtil {

    static GsonBuilder gsonBuilder = new GsonBuilder();

    static {
        gsonBuilder.disableHtmlEscaping();
    }

    public static String pojoToJson(Object object) {
        return gsonBuilder.create().toJson(object);
    }

    public static <T> T jsonToPojo(String json, Class<T> clazz) {
        return JSONObject.parseObject(json, clazz);
    }
}
